<!DOCTYPE html> 
<html> 
	
<!-- Mirrored from jquerymobile.com/demos/1.0b1/docs/pages/docs-dialogs.html by HTTrack Website Copier/3.x [XR&CO'2010], Mon, 27 Jun 2011 17:13:55 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8"><!-- /Added by HTTrack -->
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1"> 
	<title>jQuery Mobile Docs - Pages</title> 
	<link rel="stylesheet"  href="../../../../../code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css" />  
	<link rel="stylesheet" href="../assets/css/jqm-docs.css"/>
	<script src="../../../../../code.jquery.com/jquery-1.6.1.min.js"></script>
	<script src="../../experiments/themeswitcher/jquery.mobile.themeswitcher.js"></script>
	<script src="../assets/js/jqm-docs.js"></script>
	<script src="../../../../../code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"></script>
</head> 
<body> 

	<div data-role="page" class="type-interior">

		<div data-role="header" data-theme="f">
		<h1>Dialogs</h1>
		<a href="../../index.html" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
	</div><!-- /header -->

	<div data-role="content" class="ui-body">
			<div class="content-primary">
			<h2>Creating dialogs</h2>
			<p>Any page can be presented as a modal dialog by adding the <code>data-rel="dialog"</code> attribute to the page anchor link. When the "dialog" attribute is applied, the framework adds styles to add rounded corners, margins around the page and a dark background to make the "dialog" appear to be suspended above the page.</p>

			<p>
			<code>
			&lt;a href=&quot;foo.html&quot; data-rel=&quot;dialog&quot;&gt;Open dialog&lt;/a&gt;
			</code>
			</p>
			
			<a href="dialog.html" data-role="button" data-inline="true" data-rel="dialog" data-transition="pop">Open dialog</a>
			

			
			<h2>Transitions</h2>
			<p>By default, the dialog will open with a 'pop' transition.  Like all pages, you can specify any page transition you want on the dialog by adding the <code>data-transition</code> attribute to the link. To make it feel more dialog-like, we recommend specifying a transition of "pop", "slideup" or "flip".</p>
			
<code>
&lt;a href=&quot;foo.html&quot; data-rel=&quot;dialog&quot; data-transition=&quot;pop&quot;&gt;Open dialog&lt;/a&gt;
</code>
			
			<div>
			<a href="dialog.html" data-role="button" data-inline="true" data-rel="dialog" data-transition="pop">data-transition="pop"</a>
			<a href="dialog.html" data-role="button" data-inline="true" data-rel="dialog" data-transition="slidedown">data-transition="slidedown"</a>
			<a href="dialog.html" data-role="button" data-inline="true" data-rel="dialog" data-transition="flip">data-transition="flip"</a>
			</div>
	
	
			<h2>Closing dialogs</h2>
			<p>When any link is clicked within in a dialog, the framework will automatically close the dialog and transition to the requested page, just as if the dialog were a normal page. To create a "cancel" button in a dialog, just link to the page that triggered the dialog to open and add the <code>data-rel="back"</code> attribute to your link. This pattern of linking to the previous page is also usable in non-JS devices as well.</p>
			<p>For JavaScript-generated links, you can simply set the href attribute to "#" and use the <code>data-rel="back"</code> attribute. You can also call the dialog's <code>close()</code> method to programmatically close dialogs, for example: <code>$('.ui-dialog').dialog('close')</code>. </p>
			
			<h3>Setting the close button text</h3>
			<p>Just like the page plugin, you can set a dialog's close button text through option or data attribute. The option can be configured for all dialogs by binding to the <code>mobileinit</code> event and setting the <code>$.mobile.dialog.prototype.options.closeBtnText</code> property to a string of your choosing, or you can place the data attribute <code>data-close-btn-text</code> to configure the text from your markup.</p>
			
			<h2>History &amp; Back button behavior</h2>
			<p>Since dialogs are typically used to support actions within a page, the framework does not include dialogs in the hash state history tracking. This means that dialogs will not appear in your browsing history chronology when the Back button is clicked. For example, if you are on a page, click a link to open a dialog, close the dialog, then navigate to another page, if you were to click the browser's Back button at that point you will navigate back to the first page, not the dialog.</p>
			
			<h2>Styling &amp; theming</h2>
			<p>Dialogs can be styled with different themes, just like any page. Here is a different dialog design:</p>
				<a href="dialog-alt.html" data-role="button" data-inline="true" data-rel="dialog" data-transition="pop">An alternate color scheme</a>
		
		
			<p>And dialogs can be can used more like a control sheet to offer multiple buttons by removing the header:</p>
						<a href="dialog-buttons.html" data-role="button" data-inline="true" data-rel="dialog" data-transition="slidedown">Share photos...</a>
			
			
	</div><!--/content-primary -->		

	<div class="content-secondary">

		<div data-role="collapsible" data-collapsed="true" data-theme="b">

				<h3>More in this section</h3>

				<ul data-role="listview" data-theme="c" data-dividertheme="d">

					<li data-role="list-divider">Pages &amp; Dialogs</li>
					<li><a href="docs-pages.html">Anatomy of a page</a></li>
					<li><a href="docs-transitions.html">Page transitions</a></li>
					<li data-theme="a"><a href="docs-dialogs.html">Dialogs</a></li>
					<li><a href="docs-navmodel.html">Navigation: Ajax, hashes &amp; history</a></li>
					<li><a href="link-formats.html">Link format examples</a></li>
					<li><a href="pages-themes.html">Theming pages</a></li>

				</ul>
		</div>
	</div>		

</div><!-- /content -->

<div data-role="footer" class="footer-docs" data-theme="c">
		<p>&copy; 2011 The jQuery Project</p>
</div>

</div><!-- /page -->

</body>

<!-- Mirrored from jquerymobile.com/demos/1.0b1/docs/pages/docs-dialogs.html by HTTrack Website Copier/3.x [XR&CO'2010], Mon, 27 Jun 2011 17:13:56 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=UTF-8"><!-- /Added by HTTrack -->
</html>
